package com.ljsw.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.ljsw.activity.R;
import com.ljsw.entity.pkentity.PKRCAEntity.PKECAEntity;

import java.util.List;

/**
 * Created by lianchao on 2020/10/26.
 */

public class ADDBiaoPaiInfoAdapter extends BaseAdapter {
    private List<PKECAEntity> LockID;
    private Context mContext;

    public ADDBiaoPaiInfoAdapter(List<PKECAEntity> LockID, Context mContext) {
        super();
        this.LockID = LockID;
        this.mContext = mContext;
    }


    @Override
    public int getCount() {
        return LockID.size();
    }

    @Override
    public Object getItem(int position) {
        return LockID.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ADDBiaoPaiInfoAdapter.ViewHolder mviewHolder = null;
        if (mviewHolder == null) {
            mviewHolder = new ADDBiaoPaiInfoAdapter.ViewHolder();
            convertView = LayoutInflater.from(mContext).inflate(R.layout.addbiaopaiinfo_list_item, null, false);
            TextView addbiaopaiquanbie = (TextView) convertView.findViewById(R.id.addbiaopaiquanbie);
            TextView addbiaopaibanbie = (TextView) convertView.findViewById(R.id.addbiaopaibanbie);
            TextView addbiaopaicansuun = (TextView) convertView.findViewById(R.id.addbiaopaicansuun);
            TextView addbiaopaisunliang = (TextView) convertView.findViewById(R.id.addbiaopaisunliang);
            mviewHolder.addbiaopaiquanbie = addbiaopaiquanbie;
            mviewHolder.addbiaopaibanbie = addbiaopaibanbie;
            mviewHolder.addbiaopaicansuun = addbiaopaicansuun;
            mviewHolder.addbiaopaisunliang = addbiaopaisunliang;
            convertView.setTag(mviewHolder);
        } else {
            mviewHolder = (ADDBiaoPaiInfoAdapter.ViewHolder) convertView.getTag();
            convertView.setTag(mviewHolder);
        }

        mviewHolder.addbiaopaiquanbie.setText(LockID.get(position).getStrquanbie());
        mviewHolder.addbiaopaibanbie.setText(LockID.get(position).getStrbanbie());
        mviewHolder.addbiaopaicansuun.setText(LockID.get(position).getStrcansun());
        mviewHolder.addbiaopaisunliang.setText(LockID.get(position).getStrmonge());
        return convertView;
    }


    class ViewHolder {
        private TextView addbiaopaiquanbie;
        private TextView addbiaopaibanbie;
        private TextView addbiaopaicansuun;
        private TextView addbiaopaisunliang;


    }
}
